package com.itheima.sh.service;

import com.itheima.sh.dao.RoleMapper;
import com.itheima.sh.pojo.Role;
import com.itheima.sh.util.SqlSessionUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class RoleMapperImpl {
    private static SqlSession sqlSession;
    private static RoleMapper mapper;

    static {
        sqlSession = SqlSessionUtil.getSqlSession();
        mapper = sqlSession.getMapper(RoleMapper.class);
    }

    public List<Role> queryAllUsersAndRoleAndPermissionByPage(int startIndex, int pageSize) {
        List<Role> roles = mapper.queryAllUsersAndRoleAndPermissionByPage(startIndex, pageSize);
        return roles;
    }

    public List<Role> queryAllRoleAndPermissionByPage(int startIndex, int pageSize) {
        List<Role> roles =  mapper.queryAllRoleAndPermissionByPage(startIndex,pageSize);
        return roles;
    }
}
